﻿#region Copyright(C) 2018 FI Ltd. All rights reserved.
// ==================================================================================================
// Copyright(C) 2018 FI Ltd. All rights reserved.
//
// SYSTEM NAME	    : FI.Net Application Framework
// COMPONENT ID	    : FI.Core
// COMPONENT DESC   : FI.Net Core Foundation
//
// CREATED DATE/BY  : 18 Aug 2018 / Tian Mi
//
// REVISION HISTORY :	
// DATE/BY			SR#/CS/PM#/OTHERS		DESCRIPTION OF CHANGE
// ==================================================================================================
#endregion

using FI.Core.IoC;
using System;

namespace FI.Core.Configuration
{
    /// <summary>
    /// Provider based configuration element classes should be derived from this class.
    /// </summary>
    /// <typeparam name="TProvider">The type of the provider.</typeparam>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "DataBase")]
    public abstract class ProviderDataBase<TProvider>: NameTypeConfigurationElement
    {
        /// <summary>
        /// Gets the lifetime.
        /// </summary>
        /// <value>
        /// The lifetime.
        /// </value>
        public virtual Lifetime Lifetime
        {
            get { return Lifetime.Singleton; }
        }

        /// <summary>
        /// Get the delegate to create provider instance.
        /// </summary>
        /// <param name="settings">The configuration section.</param>
        /// <returns>The delegate to create provider instance.</returns>
        public virtual Func<TProvider> GetProviderCreator(ServiceLocatableSettings settings)
        {
            return null;
        }
    }
}
